package com.zen.android.sample.scananim;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.WindowManager;
import android.widget.FrameLayout;

import com.zen.android.sample.R;
import com.zen.android.sample.scananim.view.RiseNumberTextView;

/**
 * @author zeng
 * @Create at 2017/12/20
 * @Description: .
 */
public class ScanAnimActivity extends Activity {

    private FrameLayout mParentView;
    private RiseNumberTextView mNumTextView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_scan_anim);
        mParentView = (FrameLayout) findViewById(R.id.pppp);
        mNumTextView = (RiseNumberTextView) findViewById(R.id.textCounter);

        WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);

        int width = wm.getDefaultDisplay().getWidth();
        int height = wm.getDefaultDisplay().getHeight();
        int vh = dip2px(this, 200);
        ViewUtils utils = new ViewUtils(mParentView, width, vh);
        utils.start();
        mNumTextView.setFloat(0, 100000);
        mNumTextView.start();

    }

    public static int dip2px(Context context, float dpValue) {
        final float scale = context.getResources().getDisplayMetrics().density;
        return (int) (dpValue * scale + 0.5f);
    }

}
